﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Security.Cryptography;
using System.Xml;

namespace GCard
{
    public partial class XMLForm : Form
    {
        public XMLForm()
        {
            InitializeComponent();
        }

        private void XMLForm_Load(object sender, EventArgs e)
        {

        }

        private void btn_xml_Click(object sender, EventArgs e)
        {
            if (!File.Exists("Parameter.xml"))
            {
                //1、创建xml文档对象
                XmlDocument doc = new XmlDocument();
                //2、创建一个行描述信息
                XmlDeclaration decl = doc.CreateXmlDeclaration("1.0", "utf-8", null);
                doc.AppendChild(decl);
                //3、创建根节点
                XmlElement parameter = doc.CreateElement("Parameter");
                doc.AppendChild(parameter);
                //4、给根节点添加字节点
                XmlElement vel = doc.CreateElement("Vel");
                vel.InnerXml = "100";
                parameter.AppendChild(vel);

                XmlElement acc = doc.CreateElement("Acc");
                acc.InnerXml = "1";
                parameter.AppendChild(acc);

                XmlElement dec = doc.CreateElement("Dec");
                dec.InnerXml = "1";
                parameter.AppendChild(dec);

                doc.Save("Parameter.xml");
            }
            


            
        }





    }
}
